package com.qf.taobei.interceptor;

import org.codehaus.jettison.json.JSONObject;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;

public class AdminLoginInerceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        if (request.getSession().getAttribute("admin") == null){
            response.sendRedirect("/taobei-web/admin/login.html");
            return false;
        }else {
            return true;
        }
    }
}
